<template>
<el-dialog :title="title" v-model="upd.show"
  :width="width" destroy-on-close center >
  <template #mark>
    // eslint-disable-next-line
    <!-- <el-input :value="upd.row.name" placeholder=""></el-input> -->
  </template>
      <slot></slot>
  <template #footer>
    <span class="dialog-footer">
      <el-button @click="upd.show=false" size="mini">取 消</el-button>
      <el-button type="primary" size="mini" @click="upd.show=false;$emit('mySure',upd)"
        >确 定</el-button
      >
    </span>
  </template>
</el-dialog>
</template>

<script lang="ts">
import { defineComponent } from "@vue/runtime-core"
export default defineComponent({
  data() {
    return {
      title: '编辑',
      width: '60%',
      upd : {
        show: false,
        row: {},
        field: '',
      }
    }
  },
  props: {
    myTtitle: String,
    myWidth: String,
    myUpd: Object
  },
  emits: ['mySure'],
  watch:{
    myUpd: {
      deep: true,
      handler(val,oldVal){
        // console.log('child upd change' , val,oldVal);
        this.upd = val
      }
    },
    myTitle: {
      immediate: true,
      handler(val,oldVal) {
        // console.log('child title change' , val,oldVal);
        if(val) this.title = val
      }
    },
    myWidth: {
      immediate: true,
      handler(val,oldVal) {
        // console.log('child title change' , val,oldVal);
        if(val) this.width = val
      }
    },
  }
})
</script>